#!/usr/bin/python3

import logging
import os
import sys

if sys.platform=='win32':
    #log_path=os.path.split(os.getcwd())[0]+''.join(['/logs','/logs.txt'])
    log_path='D:\Dropbox\Web\Bishop\logs\Logs.log'
else:
    logpath=os.path.dirname(__file__).split('/')[0:4]
    logpath='/'.join(logpath)
    log_path=logpath+'/Web/Bishop/logs/logs.log'



formatter=logging.Formatter('%(asctime)s %(message)s','%d-%m %H:%M:%S')
#-----------------------------------------------------------------
console_handler=logging.StreamHandler(sys.stderr)
console_handler.setLevel(logging.DEBUG)
console_handler.setFormatter(formatter)
#-----------------------------------------------------------------

file_handler=logging.FileHandler(log_path, 'a')
file_handler.setFormatter(formatter)
#------------------------------------------------------------------
log=logging.getLogger('bishop')
log.setLevel(logging.DEBUG)
if sys.platform=='win32':
    log.addHandler(console_handler)
log.addHandler(file_handler)



#LOCAL TESTING
log.addHandler(console_handler)